<!DOCTYPE html>
<html lang="en">





<head>
  <meta charset="UTF-8">
  <link rel="apple-touch-icon" sizes="76x76" href="/img/apple-touch-icon.png">
  <link rel="icon" type="image/png" href="/img/favicon.png">
  <meta name="viewport"
        content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no, shrink-to-fit=no">
  <meta http-equiv="x-ua-compatible" content="ie=edge">
  
  <meta name="theme-color" content="#561f55">
  <meta name="description" content="">
  <meta name="author" content="Azerrroth">
  <meta name="keywords" content="">
  <title>OS Chapter 1 Introduction ~ Codeless</title>

  <link  rel="stylesheet" href="https://cdn.staticfile.org/twitter-bootstrap/4.4.1/css/bootstrap.min.css" />


  <link  rel="stylesheet" href="https://cdn.staticfile.org/github-markdown-css/4.0.0/github-markdown.min.css" />
  <link  rel="stylesheet" href="/lib/hint/hint.min.css" />

  
    <link  rel="stylesheet" href="https://cdn.staticfile.org/highlight.js/10.0.0/styles/github-gist.min.css" />
  

  


<!-- 主题依赖的图标库，不要自行修改 -->

<link rel="stylesheet" href="//at.alicdn.com/t/font_1749284_yg9cfy8wd6.css">



<link rel="stylesheet" href="//at.alicdn.com/t/font_1736178_pjno9b9zyxs.css">


<link  rel="stylesheet" href="/css/main.css" />

<!-- 自定义样式保持在最底部 -->


  <script  src="/js/utils.js" ></script>
<meta name="generator" content="Hexo 4.2.1"></head>


<body>
  <header style="height: 70vh;">
    <nav id="navbar" class="navbar fixed-top  navbar-expand-lg navbar-dark scrolling-navbar">
  <div class="container">
    <a class="navbar-brand"
       href="/">&nbsp;<strong>Codeless</strong>&nbsp;</a>

    <button id="navbar-toggler-btn" class="navbar-toggler" type="button" data-toggle="collapse"
            data-target="#navbarSupportedContent"
            aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
      <div class="animated-icon"><span></span><span></span><span></span></div>
    </button>

    <!-- Collapsible content -->
    <div class="collapse navbar-collapse" id="navbarSupportedContent">
      <ul class="navbar-nav ml-auto text-center">
        
          
          
          
          
            <li class="nav-item">
              <a class="nav-link" href="/">
                <i class="iconfont icon-home-fill"></i>
                Home
              </a>
            </li>
          
        
          
          
          
          
            <li class="nav-item">
              <a class="nav-link" href="/archives/">
                <i class="iconfont icon-archive-fill"></i>
                Archives
              </a>
            </li>
          
        
          
          
          
          
            <li class="nav-item">
              <a class="nav-link" href="/categories/">
                <i class="iconfont icon-category-fill"></i>
                Categories
              </a>
            </li>
          
        
          
          
          
          
            <li class="nav-item">
              <a class="nav-link" href="/tags/">
                <i class="iconfont icon-tags-fill"></i>
                Tags
              </a>
            </li>
          
        
          
          
          
          
            <li class="nav-item">
              <a class="nav-link" href="/about/">
                <i class="iconfont icon-user-fill"></i>
                About
              </a>
            </li>
          
        
        
          <li class="nav-item" id="search-btn">
            <a class="nav-link" data-toggle="modal" data-target="#modalSearch">&nbsp;&nbsp;<i
                class="iconfont icon-search"></i>&nbsp;&nbsp;</a>
          </li>
        
      </ul>
    </div>
  </div>
</nav>

    <div class="view intro-2" id="background" parallax=true
         style="background: url('/img/Background/earth.jpg') no-repeat center center;
           background-size: cover;">
      <div class="full-bg-img">
        <div class="mask flex-center" style="background-color: rgba(0, 0, 0, 0.3)">
          <div class="container text-center white-text fadeInUp">
            <span class="h2" id="subtitle">
              
            </span>

            
              
  <div class="mt-3 post-meta">
    <i class="iconfont icon-date-fill" aria-hidden="true"></i>
    <time datetime="2020-01-16 19:20">
      January 16, 2020 pm
    </time>
  </div>


<div class="mt-1">
  
    
    <span class="post-meta mr-2">
      <i class="iconfont icon-chart"></i>
      1.7k 字
    </span>
  

  
    
    <span class="post-meta mr-2">
      <i class="iconfont icon-clock-fill"></i>
      
      
      18
       分钟
    </span>
  

  
  
    
      <!-- 不蒜子统计文章PV -->
      <span id="busuanzi_container_page_pv" style="display: none">
        <i class="iconfont icon-eye" aria-hidden="true"></i>
        <span id="busuanzi_value_page_pv"></span> 次
      </span>
    
  
</div>

            
          </div>

          
        </div>
      </div>
    </div>
  </header>

  <main>
    
      

<div class="container-fluid">
  <div class="row">
    <div class="d-none d-lg-block col-lg-2"></div>
    <div class="col-lg-8 nopadding-md">
      <div class="container nopadding-md" id="board-ctn">
        <div class="py-5" id="board">
          <div class="post-content mx-auto" id="post">
            
            <article class="markdown-body">
              <a id="more"></a>
<h2 id="Operating-System"><a href="#Operating-System" class="headerlink" title="Operating System"></a>Operating System</h2><h3 id="什么是操作系统"><a href="#什么是操作系统" class="headerlink" title="什么是操作系统"></a>什么是操作系统</h3><p>控制和管理整个计算机系统的<strong>硬件和软件资源</strong>，并合理组织调度计算机的<strong>工作和资源的分配</strong>，以提供给用户和其他软件方便的接口和环境，它是计算机系统中<strong>最基本的系统软件</strong>。</p>
<ol>
<li>负责管理协调硬件、软件等计算机资源的工作</li>
<li>为上层的应用程序、用户提供简单易用的服务</li>
<li>操作系统是<strong>系统软件</strong>，而不是硬件</li>
</ol>
<h2 id="Basic-Concepts-of-OS"><a href="#Basic-Concepts-of-OS" class="headerlink" title="Basic Concepts of OS"></a>Basic Concepts of OS</h2><p>Processes：进程管理，进程树<br>Address spaces：地址空间，物理内存、虚拟内存<br>Files：文件系统，文件和目录<br>Input/Output：输入输出，I/O<br>Protection：硬件和软件<br>The shell：命令提示符<br>System Call：系统调用</p>
<ul>
<li>用户程序和系统程序之间的接口</li>
<li>在内核模式执行</li>
<li>POSIX API/ Windows Win32 API</li>
<li>系统调用类型<ul>
<li>进程控制：创建、终结进程，获取/设置 进程参数</li>
<li>文件操作：Create；delete；read；write；get/set file attributes</li>
<li>设备管理：Request；Release；Read；Write</li>
<li>Socket：Connection：Open/Accept/Read/Write/Close</li>
<li>信息维护：获取当前的日期，OS Version等</li>
</ul>
</li>
</ul>
<p><img src="https://cdn.nlark.com/yuque/0/2020/png/431085/1579173405333-9f452da9-ab11-47a5-a520-09ed9eedd5d6.png#align=left&amp;display=inline&amp;height=342&amp;name=image.png&amp;originHeight=342&amp;originWidth=641&amp;size=74291&amp;status=done&amp;style=none&amp;width=641" srcset="/img/loading.gif" alt="image.png"></p>
<h2 id="Characters-of-OS-操作系统的特征"><a href="#Characters-of-OS-操作系统的特征" class="headerlink" title="Characters of OS 操作系统的特征"></a>Characters of OS 操作系统的特征</h2><h3 id="Concurrency：并发"><a href="#Concurrency：并发" class="headerlink" title="Concurrency：并发"></a><strong>Concurrency：并发</strong></h3><p>并发 Concurrency：逻辑并发（宏观上看是同时执行的，微观上，是划分为小的时间片，一段时间A用，一段时间B用）<br>并行 Parallel：物理并发（A、B两个程序真的在同时执行</p>
<h3 id="Share：共享"><a href="#Share：共享" class="headerlink" title="Share：共享"></a><strong>Share：共享</strong></h3><p>CPU，Main Memory，Storage，I/O devices<br>Space，Time<br>互斥共享方式：一个时间段只允许一个进程访问该资源<br>同时共享方式：允许一个时间段由多个进程“同时”对它们进行访问</p>
<h3 id="Virtualization：虚拟"><a href="#Virtualization：虚拟" class="headerlink" title="Virtualization：虚拟"></a><strong>Virtualization：虚拟</strong></h3><p>虚拟式把物理上的实体变为若干个逻辑上的对应物。物理上实体是物理存在的，而逻辑上对应物是用户感受到的。<br>空分复用技术：虚拟内存，虚拟存储器技术<br>时分复用技术：单核CPU多线程，虚拟处理器<br>没有并发性，就谈不上虚拟性</p>
<h3 id="Asynchronism：异步"><a href="#Asynchronism：异步" class="headerlink" title="Asynchronism：异步"></a><strong>Asynchronism：异步</strong></h3><p>多道程序环境下，资源有限，程序以不可预知的速度向前推进，就是进程的异步性。<br><strong>只有系统拥有并发性，才有可能导致异步性。</strong></p>
<p><img src="https://cdn.nlark.com/yuque/0/2020/png/431085/1579173184991-de572ab8-06fe-4e7b-95ee-e40b454954eb.png#align=left&amp;display=inline&amp;height=346&amp;originHeight=346&amp;originWidth=904&amp;status=done&amp;style=none&amp;width=904" srcset="/img/loading.gif" alt="https://cdn.nlark.com/yuque/0/2020/png/431085/1579173184991-de572ab8-06fe-4e7b-95ee-e40b454954eb.png#align=left&amp;display=inline&amp;height=346&amp;originHeight=346&amp;originWidth=904&amp;status=done&amp;style=none&amp;width=904"><br><strong>知识点：</strong><br>并发与并行的区别<br>并发与共享互为存在条件<br>没有并发和共享，就谈不上虚拟和异步，因此<strong>并发</strong>和<strong>共享</strong>是操作系统的两个<strong>最基本的特征</strong></p>
<h2 id="OS-Runtime-Structure-运行机制体系结构"><a href="#OS-Runtime-Structure-运行机制体系结构" class="headerlink" title="OS Runtime Structure 运行机制体系结构"></a>OS Runtime Structure 运行机制体系结构</h2><h3 id="运行机制"><a href="#运行机制" class="headerlink" title="运行机制"></a>运行机制</h3><p>两种指令：</p>
<ul>
<li>特权指令：如I/O指令、内存清零指令</li>
<li>非特权指令：如运算指令</li>
</ul>
<p>两种处理器状态：程序状态字寄存器（PSW）</p>
<ul>
<li>用户态：CPU只能执行非特权指令</li>
<li>核心态：特权指令、非特权指令都可以执行</li>
</ul>
<p>两种程序：</p>
<ul>
<li>内核程序：系统的管理者，既可以执行特权指令，也可以执行非特权指令，运行在核心态。</li>
<li>应用程序：普通应用程序只能执行非特权指令，运行在用户态。</li>
</ul>
<p><img src="https://cdn.nlark.com/yuque/0/2020/png/431085/1579173185433-db7ed8c8-96bc-4195-8094-47fa55f4aa4d.png#align=left&amp;display=inline&amp;height=412&amp;originHeight=412&amp;originWidth=988&amp;status=done&amp;style=none&amp;width=988" srcset="/img/loading.gif" alt=""><br>单体系统：全部操作系统在内核态中以单一程序的方式运行<br>主程序：处理服务过程请求<br>服务过程：执行系统调用<br>使用过程：辅助服务过程<br><img src="https://cdn.nlark.com/yuque/0/2020/png/431085/1579173185860-a6e659c6-5dc8-4746-98d7-e6d306e4dc19.png#align=left&amp;display=inline&amp;height=414&amp;originHeight=414&amp;originWidth=932&amp;status=done&amp;style=none&amp;width=932" srcset="/img/loading.gif" alt=""><br>层次式系统：上层软件都是在下一层软件的基础上构建的。<br><img src="https://cdn.nlark.com/yuque/0/2020/png/431085/1579173186193-f5a7dbe9-1bb0-42d7-83d8-71b51ab939c8.png#align=left&amp;display=inline&amp;height=342&amp;originHeight=342&amp;originWidth=744&amp;status=done&amp;style=none&amp;width=744" srcset="/img/loading.gif" alt=""><br>微内核：<br>仅有一个模块（微内核）运行在内核态，剩下全都在用户态。MINIX 3 微内核<br>只有时钟管理、中断处理、原语等，不包括进程管理、存储器管理、设备管理等功能。<br><img src="https://cdn.nlark.com/yuque/0/2020/png/431085/1579173186536-92fd38d9-dd41-4c81-83be-8cd9665cbd2e.png#align=left&amp;display=inline&amp;height=384&amp;originHeight=384&amp;originWidth=756&amp;status=done&amp;style=none&amp;width=756" srcset="/img/loading.gif" alt=""><br><img src="https://cdn.nlark.com/yuque/0/2020/png/431085/1579173186920-c0cd99a3-42a8-4636-a3e4-98051b729e0c.png#align=left&amp;display=inline&amp;height=410&amp;originHeight=410&amp;originWidth=752&amp;status=done&amp;style=none&amp;width=752" srcset="/img/loading.gif" alt=""><br>Client-Server模式（Web运行模式）<br>服务器：提供服务<br>客户端：使用服务<br>服务器与客户端之间通过消息传递方式<br>虚拟机：</p>
<ol>
<li>VM370</li>
<li>多道程序</li>
<li>一个比裸机更方便、有扩展界面的计算机。裸机硬件的精确复刻品<br><img src="https://cdn.nlark.com/yuque/0/2020/png/431085/1579173187230-8cfa07ac-ed11-459f-9019-4eae69dd5edd.png#align=left&amp;display=inline&amp;height=294&amp;originHeight=294&amp;originWidth=678&amp;status=done&amp;style=none&amp;width=678" srcset="/img/loading.gif" alt=""> </li>
<li>hypervisor Ⅰ<br><img src="https://cdn.nlark.com/yuque/0/2020/png/431085/1579173187677-f8abcd41-bdfe-42c3-b3d5-c92cda38a8cb.png#align=left&amp;display=inline&amp;height=476&amp;originHeight=476&amp;originWidth=906&amp;status=done&amp;style=none&amp;width=906" srcset="/img/loading.gif" alt=""> </li>
</ol>
<p>外核（exokernel）：<br>通过<strong>拆分硬件资源</strong>来分配给虚拟机，比如一块硬盘，某个虚拟机获得磁盘的0-1023盘块，而另一台虚拟机获得1024-2047盘块。<br>这样做减少了映射层，这样就少了一张表格来维护重映像磁盘地址。</p>
<h2 id="中断和异常"><a href="#中断和异常" class="headerlink" title="中断和异常"></a>中断和异常</h2><h3 id="中断机制的诞生"><a href="#中断机制的诞生" class="headerlink" title="中断机制的诞生"></a>中断机制的诞生</h3><p>发生中断意味着需要操作系统介入，开展管理工作</p>
<h3 id="中断的概念和作用"><a href="#中断的概念和作用" class="headerlink" title="中断的概念和作用"></a>中断的概念和作用</h3><ol>
<li>中断发生时，CPU会立即进入<strong>核心态</strong></li>
<li>中断发生后，当前运行进程暂停运行，并由操作系统内核对中断进行处理</li>
<li>中断信号不同，处理方式不同</li>
</ol>
<p>有了中断，才能实现<strong>多道程序并发执行</strong>。<br>中断可以使CPU从用户态切换为核心态，被操作系统获得计算机的控制权。</p>
<div class="table-container">
<table>
<thead>
<tr>
<th>用户态→核心态</th>
<th>中断</th>
</tr>
</thead>
<tbody>
<tr>
<td>核心态→用户态</td>
<td>改变程序状态字</td>
</tr>
</tbody>
</table>
</div>
<h3 id="中断的分类"><a href="#中断的分类" class="headerlink" title="中断的分类"></a>中断的分类</h3><p>内中断（也称异常、例外、陷入（陷阱））：<strong>信号来源</strong>：CPU内部，与当前执行的指令相关。<br>自愿中断——指令中断<br>强迫中断<br><strong>硬件故障</strong>：如缺页<br>软件中断：如软件出现异常Exception<br>外中断（中断——狭义的中断）：<strong>信号来源</strong>：CPU外部，与当前执行的指令无关<br>外设请求：如IO完成操作<br>人工干预：用户强制停止进程</p>
<p>外中断处理过程：</p>
<ol>
<li>每条指令执行完后检查是否有中断请求</li>
<li>如果检测到中断请求，保护被中断程序的CPU环境（保护现场）（如程序状态字、程序计数器、寄存器）</li>
<li>根据中断信号处理中断程序</li>
<li>恢复原程序的CPU环境（<strong>恢复现场</strong>）并退出中断，返回原程序继续执行<br><img src="https://cdn.nlark.com/yuque/0/2020/png/431085/1579173188337-f5e314fd-5026-46a1-874b-122c7eacbf4e.png#align=left&amp;display=inline&amp;height=666&amp;originHeight=666&amp;originWidth=1062&amp;status=done&amp;style=none&amp;width=1062" srcset="/img/loading.gif" alt=""> </li>
</ol>
<h2 id="系统调用"><a href="#系统调用" class="headerlink" title="系统调用"></a>系统调用</h2><h3 id="什么是系统调用"><a href="#什么是系统调用" class="headerlink" title="什么是系统调用"></a>什么是系统调用</h3><p><img src="https://cdn.nlark.com/yuque/0/2020/png/431085/1579173188637-a41e4130-c9fd-424b-bd48-e3f18820a904.png#align=left&amp;display=inline&amp;height=238&amp;originHeight=238&amp;originWidth=360&amp;status=done&amp;style=none&amp;width=360" srcset="/img/loading.gif" alt=""><br><strong>程序接口</strong>就是由一组系统调用来组成的</p>
<p>应用程序通过<strong>系统调用</strong>请求操作系统的服务。需要<strong>访问系统资源</strong>，都需要系统代为完成，所以需要系统调用，这样可以保证系统的稳定性和安全性，防止用户的非法操作。<br><strong>系统调用会让CPU从用户态进入核心态</strong></p>
<p><img src="https://cdn.nlark.com/yuque/0/2020/png/431085/1579173188990-8137f146-6154-4d50-a2a4-52327858beb6.png#align=left&amp;display=inline&amp;height=284&amp;originHeight=284&amp;originWidth=1008&amp;status=done&amp;style=none&amp;width=1008" srcset="/img/loading.gif" alt=""> </p>
<h3 id="系统调用-amp-库函数"><a href="#系统调用-amp-库函数" class="headerlink" title="系统调用 &amp; 库函数"></a>系统调用 &amp; 库函数</h3><p>系统调用是操作系统向上层提供的接口<br>有些库函数是对系统调用的进一步封装<br>当今应用程序大多通过高级语言直接or间接进行系统调用</p>
<h3 id="系统调用背后过程"><a href="#系统调用背后过程" class="headerlink" title="系统调用背后过程"></a>系统调用背后过程</h3><ol>
<li>传递系统调用参数</li>
<li>执行<strong>陷入</strong>（trap、int）指令</li>
<li>执行系统调用相应服务程序</li>
<li>返回用户程序<br><img src="https://cdn.nlark.com/yuque/0/2020/png/431085/1579173189616-6145f499-f5f5-4dd6-a76d-c3c730acae44.png#align=left&amp;display=inline&amp;height=680&amp;originHeight=680&amp;originWidth=1038&amp;status=done&amp;style=none&amp;width=1038" srcset="/img/loading.gif" alt=""> </li>
</ol>
<h2 id="操作系统的管理功能"><a href="#操作系统的管理功能" class="headerlink" title="操作系统的管理功能"></a>操作系统的管理功能</h2><ul>
<li>进程管理</li>
<li>存储管理</li>
<li>设备管理</li>
<li>文件管理</li>
<li>作业管理</li>
</ul>

            </article>
            <hr>
            <div>
              <div class="post-metas mb-3">
                
                  <div class="post-meta mr-3">
                    <i class="iconfont icon-category"></i>
                    
                      <a class="hover-with-bg" href="/categories/%E6%93%8D%E4%BD%9C%E7%B3%BB%E7%BB%9F-Operating-System/">操作系统(Operating System)</a>
                    
                  </div>
                
                
                  <div class="post-meta">
                    <i class="iconfont icon-tags"></i>
                    
                      <a class="hover-with-bg" href="/tags/Operating-System/">Operating System</a>
                    
                  </div>
                
              </div>
              
                <p class="note note-warning">本博客所有文章除特别声明外，均采用 <a href="https://zh.wikipedia.org/wiki/Wikipedia:CC_BY-SA_3.0%E5%8D%8F%E8%AE%AE%E6%96%87%E6%9C%AC" target="_blank" rel="nofollow noopener noopener">CC BY-SA 3.0协议</a> 。转载请注明出处！</p>
              
              
                <div class="post-prevnext row">
                  <div class="post-prev col-6">
                    
                    
                      <a href="/2020/02/03/OS-Chapter-2-Process-Thread-Concepts/">
                        <i class="iconfont icon-arrowleft"></i>
                        <span class="hidden-mobile">OS Chapter 2 Process & Thread Concepts</span>
                        <span class="visible-mobile">Previous</span>
                      </a>
                    
                  </div>
                  <div class="post-next col-6">
                    
                    
                      <a href="/2020/01/16/FAT32_File_System/">
                        <span class="hidden-mobile">FAT32 File System</span>
                        <span class="visible-mobile">Next</span>
                        <i class="iconfont icon-arrowright"></i>
                      </a>
                    
                  </div>
                </div>
              
            </div>

            
              <!-- Comments -->
              <div class="comments" id="comments">
                
                
  <script type="text/javascript">
    function loadUtterances() {
      var s = document.createElement('script');
      s.setAttribute('src', 'https://utteranc.es/client.js');
      s.defer = false
      s.setAttribute('repo', 'Azerrroth/comments-utterances');
      s.setAttribute('issue-term', 'pathname');
      
      s.setAttribute('theme', 'github-light');
      s.setAttribute('crossorigin', 'anonymous');
      var e = document.getElementsByTagName('script')[0];
      e.parentNode.insertBefore(s, e);
    }
    createObserver(loadUtterances, 'comments')
  </script>


              </div>
            
          </div>
        </div>
      </div>
    </div>
    
      <div class="d-none d-lg-block col-lg-2 toc-container" id="toc-ctn">
        <div id="toc">
  <p class="toc-header"><i class="iconfont icon-list"></i>&nbsp;TOC</p>
  <div id="tocbot"></div>
</div>

      </div>
    
  </div>
</div>

<!-- Custom -->


    
  </main>

  
    <a id="scroll-top-button" href="#" role="button">
      <i class="iconfont icon-arrowup" aria-hidden="true"></i>
    </a>
  

  
    <div class="modal fade" id="modalSearch" tabindex="-1" role="dialog" aria-labelledby="ModalLabel"
     aria-hidden="true">
  <div class="modal-dialog modal-dialog-scrollable modal-lg" role="document">
    <div class="modal-content">
      <div class="modal-header text-center">
        <h4 class="modal-title w-100 font-weight-bold">Search</h4>
        <button type="button" id="local-search-close" class="close" data-dismiss="modal" aria-label="Close">
          <span aria-hidden="true">&times;</span>
        </button>
      </div>
      <div class="modal-body mx-3">
        <div class="md-form mb-5">
          <input type="text" id="local-search-input" class="form-control validate">
          <label data-error="x" data-success="v"
                 for="local-search-input">keyword</label>
        </div>
        <div class="list-group" id="local-search-result"></div>
      </div>
    </div>
  </div>
</div>
  

  

  

  <footer class="mt-5">
  <div class="text-center py-3">
    <div>
      <a href="https://hexo.io" target="_blank" rel="nofollow noopener"><span>Hexo</span></a>
      <i class="iconfont icon-love"></i>
      <a href="https://github.com/fluid-dev/hexo-theme-fluid" target="_blank" rel="nofollow noopener">
        <span>Fluid</span></a>
    </div>
    
  <div class="statistics">
    
    

    
      
        <!-- 不蒜子统计PV -->
        <span id="busuanzi_container_site_pv" style="display: none">
            总访问量 
            <span id="busuanzi_value_site_pv"></span>
             次
          </span>
      
      
        <!-- 不蒜子统计UV -->
        <span id="busuanzi_container_site_uv" style="display: none">
            总访客数 
            <span id="busuanzi_value_site_uv"></span>
             人
          </span>
      
    
  </div>


    

    
  </div>
</footer>

<!-- SCRIPTS -->
<script  src="https://cdn.staticfile.org/jquery/3.4.1/jquery.min.js" ></script>
<script  src="https://cdn.staticfile.org/twitter-bootstrap/4.4.1/js/bootstrap.min.js" ></script>
<script  src="/js/debouncer.js" ></script>
<script  src="/js/main.js" ></script>

<!-- Plugins -->


  
    <script  src="/js/lazyload.js" ></script>
  



  <script defer src="https://cdn.staticfile.org/clipboard.js/2.0.6/clipboard.min.js" ></script>
  <script  src="/js/clipboard-use.js" ></script>



  <script defer src="https://busuanzi.ibruce.info/busuanzi/2.3/busuanzi.pure.mini.js" ></script>





  <script  src="https://cdn.staticfile.org/tocbot/4.11.1/tocbot.min.js" ></script>
  <script>
    $(document).ready(function () {
      var boardCtn = $('#board-ctn');
      var boardTop = boardCtn.offset().top;

      tocbot.init({
        tocSelector: '#tocbot',
        contentSelector: 'article.markdown-body',
        headingSelector: 'h1,h2,h3,h4,h5,h6',
        linkClass: 'tocbot-link',
        activeLinkClass: 'tocbot-active-link',
        listClass: 'tocbot-list',
        isCollapsedClass: 'tocbot-is-collapsed',
        collapsibleClass: 'tocbot-is-collapsible',
        collapseDepth: 0,
        scrollSmooth: true,
        headingsOffset: -boardTop
      });
      if ($('.toc-list-item').length > 0) {
        $('#toc').css('visibility', 'visible');
      }
    });
  </script>



  <script  src="https://cdn.staticfile.org/typed.js/2.0.11/typed.min.js" ></script>
  <script>
    var typed = new Typed('#subtitle', {
      strings: [
        '  ',
        "OS Chapter 1 Introduction&nbsp;",
      ],
      cursorChar: "_",
      typeSpeed: 70,
      loop: false,
    });
    typed.stop();
    $(document).ready(function () {
      $(".typed-cursor").addClass("h2");
      typed.start();
    });
  </script>



  <script  src="https://cdn.staticfile.org/anchor-js/4.2.2/anchor.min.js" ></script>
  <script>
    anchors.options = {
      placement: "right",
      visible: "false",
      
    };
    var el = "h1,h2,h3,h4,h5,h6".split(",");
    var res = [];
    for (item of el) {
      res.push(".markdown-body > " + item)
    }
    anchors.add(res.join(", "))
  </script>



  <script  src="/js/local-search.js" ></script>
  <script>
    var path = "/local-search.xml";
    var inputArea = document.querySelector("#local-search-input");
    inputArea.onclick = function () {
      searchFunc(path, 'local-search-input', 'local-search-result');
      this.onclick = null
    }
  </script>



  <script  src="https://cdn.staticfile.org/fancybox/3.5.7/jquery.fancybox.min.js" ></script>
  <link  rel="stylesheet" href="https://cdn.staticfile.org/fancybox/3.5.7/jquery.fancybox.min.css" />

  <script>
    $('#post img:not(.no-zoom img, img[no-zoom]), img[zoom]').each(
      function () {
        var element = document.createElement('a');
        $(element).attr('data-fancybox', 'images');
        $(element).attr('href', $(this).attr('src'));
        $(this).wrap(element);
      }
    );
  </script>





  

  
    <!-- MathJax -->
    <script>
      MathJax = {
        tex: {
          inlineMath: [['$', '$'], ['\\(', '\\)']]
        },
        options: {
          renderActions: {
            findScript: [10, doc => {
              document.querySelectorAll('script[type^="math/tex"]').forEach(node => {
                const display = !!node.type.match(/; *mode=display/);
                const math = new doc.options.MathItem(node.textContent, doc.inputJax[0], display);
                const text = document.createTextNode('');
                node.parentNode.replaceChild(text, node);
                math.start = { node: text, delim: '', n: 0 };
                math.end = { node: text, delim: '', n: 0 };
                doc.math.push(math);
              });
            }, '', false],
            insertedScript: [200, () => {
              document.querySelectorAll('mjx-container').forEach(node => {
                let target = node.parentNode;
                if (target.nodeName.toLowerCase() === 'li') {
                  target.parentNode.classList.add('has-jax');
                }
              });
            }, '', false]
          }
        }
      };
    </script>

    <script async src="https://cdn.staticfile.org/mathjax/3.0.5/es5/tex-svg.js" ></script>

  













  

  

  

  

  

  





</body>
</html>
